package com.tanhua.model.mongo;

import cn.hutool.core.bean.BeanUtil;
import com.tanhua.model.vo.QuestionsVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

//问卷列表返回值(一个问卷的实体类)

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TestSoulVo {

    private String id; //问卷id
    private String name;//问卷名称
    private String cover;//封面
    private String level;//级别
    private Integer star;//星级
    private List<QuestionsVo> questions;
    private Integer isLock;//是否锁住 (0解锁,1锁住)
    private String reportId; //最新报告结果


    public static TestSoulVo init(List<QuestionsVo> list, TestSoul testSoul) {
        TestSoulVo vo = new TestSoulVo();

        //设置问卷vo数据
        BeanUtil.copyProperties(testSoul,vo);
        vo.setId(testSoul.getId().toString());
        vo.setQuestions(list);

        //返回数据
        return vo;
    }

}
